"""
Copyright (c) Huawei Technologies Co., Ltd. 2021-2021. All rights reserved.
Description: 上机编程认证
Note: 缺省代码仅供参考，可自行决定使用、修改或删除
"""
from typing import List


class Solution:
    def version_upgrade(self, old_versions: List[str], new_version: str) -> int:
        def compare_version(version1, version2):
            def compare_sequence(sequence1, sequence2):
                n1 = len(sequence1)
                n2 = len(sequence2)
                i = 0
                while True:
                    if i == n1 == n2:
                        return 0
                    elif i == n1:
                        return -1
                    elif i == n2:
                        return 1

                    a, b = int(sequence1[i]), int(sequence2[i])
                    if a == b:
                        i = i + 1
                        continue
                    elif a < b:
                        return -1
                    else:
                        return 1
            sequence1 = version1.split('.')
            sequence2 = version2.split('.')
            return compare_sequence(sequence1, sequence2)

        result = sum(1 for x in old_versions if compare_version(x, new_version) < 0)
        return result

xx = Solution().version_upgrade('100.200 20.500 100.5 100.05.0 0.0.0.0 100.50.1 100.50.0'.split(), '100.50')
print(xx)

if __name__ == "__main__":
    num = int(input().strip())
    if num == 0:
        old_versions_str = input()
        old_versions = []
    else:
        old_versions = input().strip().split()
    new_version = input().strip()
    function = Solution()
    results = function.version_upgrade(old_versions, new_version)
    print(results)
